package com.epi.two;

import java.util.*;
import java.util.stream.*;

/**
 * @author dxy
 * @version 1.0
 */
public class StreamDemo {
    public static void main(String[] args) {
//        peekMethod();
//        optionalMethod(Optional.ofNullable(null));
    }

    private static void optionalMethod(Optional<String> optionString) {
        Optional<String> newS= optionString.map(s -> s.toUpperCase());
        System.out.println("Done   "+newS);
        System.out.println(newS.orElse("Null"));
    }

    private static void peekMethod() {
        Stream<String> limit = Stream.of("Amy", "Qurk", "Bob", "Queen")
            .peek(System.out::println)
            .filter(a -> a.startsWith("Q"))
            .peek(System.out::println)
            .limit(1);
        limit.forEach(System.out::println);
    }
}
